package com.ict.web.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ict.common.annotation.Excel;
import com.ict.common.utils.bean.BeanUtils;
import com.ict.common.utils.uuid.IdUtils;
import com.ict.web.controller.file.domain.YzqFile;
import com.ict.web.domain.AnnualDeclaration;
import com.ict.web.domain.MilestoneInformation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Data
public class MilestoneInformationAddDto {
    /** 项目id */
    @ApiModelProperty(value = "项目id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "项目id不能为空")
    private Long proId;

    /** 里程碑名称 */
    @Excel(name = "里程碑名称")
    @ApiModelProperty(value = "里程碑名称")
    private List<MilestoneInformationDto> milestoneInformationList;

    /**
     * 将 MilestoneInformationAddDto 转化为 MilestoneInformation
     *
     * @param dto 接收dto
     * @return MilestoneInformation
     */
    public static MilestoneInformation of(MilestoneInformationDto dto){
        MilestoneInformation bean = new MilestoneInformation();
        BeanUtils.copyProperties(dto,bean);

        //设置ID
        bean.setMilepostId(IdUtils.snowId());
        //设置创建时间
        bean.setCreateTime(LocalDateTime.now());
        //设置创建时间
        bean.setUpdateTime(LocalDateTime.now());
        //设置物理删除标记
        bean.setDelFlag("0");

        return bean;
    }
}
